<template>
	<view class="container">
		<cu-custom bgColor="bg-blue">
			<block style="font-size: 32rpx;" slot="content">{{title}}</block>
		</cu-custom>
		<view style="padding-top: 10rpx;" class="bg-top bg-blue" :animation="animationData">
			<view class="top-box shadow" style="padding:0rpx !important;">
				<swiper style="min-height: 300rpx;" class="screen-swiper" :class="dotStyle?'square-dot':'round-dot'" :indicator-dots="true" :circular="true"
				 :autoplay="true" interval="5000" duration="500">
					<swiper-item style="border-radius: 12rpx;" v-for="(item,index) in swiperList" :key="index">
						<image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
						<video :src="item.url" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type=='video'"></video>
					</swiper-item>
				</swiper>
			</view>
			
			<view v-if="IsWeChatAutoRegister==1&&attendance.length>0" class="top-box shadow">
				<view class="cu-list menu">
					<view class="cu-item" style="padding: 0;">
						<view class="cu-item-title">
							<text class="cu-item-title-text">考勤</text>
						</view>		
					</view>
				</view>
				<view style="margin-top: -30rpx !important;" class="cu-list menu">
					<view class="index_sort_6">
						<view id="sort" class="sort">
							<view v-for="(item_sort, index) in attendance" :key="index" class="item">
								<image v-on:click="click(item_sort.id)" :data-index="index"  :src="item_sort.pic" mode="scaleToFill" border="0"    class="pic"></image>
								<text decode="true" class="title">{{item_sort.title}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="workflow.length>0" class="top-box shadow">
				<view class="cu-list menu">
					<view class="cu-item" style="padding: 0;">
						<view class="cu-item-title">
							<text class="cu-item-title-text">工作任务</text>
						</view>	
						<view class="cu-item-title">
							<text style="display: none;" class="cu-item-title-right">所有数据 ></text>
						</view>		
					</view>
				</view>
				<view style="margin-top: -30rpx !important;" class="cu-list menu">
					<view class="index_sort_6">
						<view id="sort" class="sort">
							<view v-for="(item_sort, index) in workflow" :key="index" class="item">
								<view class="itemBox">
									<image v-on:click="click(item_sort.id)" :data-index="index"  :src="item_sort.pic" mode="scaleToFill" border="0" class="pic">
									</image>
									<text decode="true" class="title">
										{{item_sort.title}}	
									</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="scene.length>0" class="top-box shadow">
				<view class="cu-list menu">
					<view class="cu-item" style="padding: 0;">
						<view class="cu-item-title">
							<text class="cu-item-title-text">工作</text>
						</view>	
						<view class="cu-item-title">
							<text style="display: none;" class="cu-item-title-right">所有数据 ></text>
						</view>		
					</view>
				</view>
				<view style="margin-top: -30rpx !important;" class="cu-list menu">
					<view class="index_sort_6">
						<view id="sort" class="sort">
							<view v-for="(item_sort, index) in scene" :key="index" class="item">
								<view class="itemBox">
									<image v-on:click="click(item_sort.id)" :data-index="index"  :src="item_sort.pic" mode="scaleToFill" border="0" class="pic">
									</image>
									<text decode="true" class="title">
										{{item_sort.title}}	
									</text>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view  v-if="IsWeChatAutoRegister==1&&qrcode.length>0" class="top-box shadow">
				<view class="cu-list menu">
					<view class="cu-item" style="padding: 0;">
						<view class="cu-item-title">
							<text class="cu-item-title-text">定期巡检</text>
						</view>		
					</view>
				</view>
				<view style="margin-top: -30rpx !important;" class="cu-list menu">
					<view class="index_sort_6">
						<view id="sort" class="sort">
							<view v-for="(item_sort, index) in qrcode" :key="index" class="item">
								<image v-on:click="click(item_sort.id)" :data-index="index"  :src="item_sort.pic" mode="scaleToFill" border="0"    class="pic"></image>
								<text decode="true" class="title">{{item_sort.title}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="IsWeChatAutoRegister==1&&baobiao.length>0" class="top-box shadow">
				<view class="cu-list menu">
					<view class="cu-item" style="padding: 0;">
						<view class="cu-item-title">
							<text class="cu-item-title-text">数据统计</text>
						</view>		
					</view>
				</view>
				<view style="margin-top: -30rpx !important;" class="cu-list menu">
					<view class="index_sort_6">
						<view id="sort" class="sort">
							<view v-for="(item_sort, index) in baobiao" :key="index" class="item">
								<image v-on:click="click(item_sort.id)" :data-index="index"  :src="item_sort.pic" mode="scaleToFill" border="0"    class="pic"></image>
								<text decode="true" class="title">{{item_sort.title}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<view  v-if="IsWeChatAutoRegister==1" class="top-box shadow">
				<view class="cu-list menu">
					<view class="cu-item" style="padding: 0;">
						<view class="cu-item-title">
							<text class="cu-item-title-text">基础功能</text>
						</view>		
					</view>
				</view>
				<view style="margin-top: -30rpx !important;" class="cu-list menu">
					<view class="index_sort_6">
						<view id="sort" class="sort">
							<view v-for="(item_sort, index) in manager" :key="index" class="item">
								<image v-on:click="click(item_sort.id)" :data-index="index"  :src="item_sort.pic" mode="scaleToFill" border="0"    class="pic"></image>
								<text decode="true" class="title">{{item_sort.title}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view style="height: 200rpx;width: 100%;">
			</view>
		</view>
		
		<ba-tree-picker ref="treePicker" :multiple='true' :showAll='false'  title="组织架构"
		     :localdata="treeUserList" valueKey="id" textKey="name" childrenKey="children" />
			 
		<!-- 悬浮图标 -->
		<view class="floating-icon" :style="{ bottom: '300rpx' }">
			<!-- ai.png 的动画 -->
			<transition name="slide-right">
				<image
				v-if="showAI"
				:src="ai_png"
				mode="aspectFit"
				class="ai-icon"
				@click="handleAIClick"
				></image>
			</transition>

			<!-- ai-right.png 的动画 -->
			<transition name="slide-up">
				<image
				v-if="showAIRight"
				:src="ai_right_png"
				mode="aspectFit"
				class="ai-right-icon"
				@click="handleAIRightClick"
				></image>
			</transition>
		</view>
	</view>
</template>

<script>
import unifab from "../../../components/beyondGod-drag/beyoundGod-drag.vue";	
import request from '@/common/request.js';
import request1 from '@/common/request.js';
export default {
	components: {
		unifab
	},
	data() {
		return {
			swiperList: [{
				id: 0,
				type: 'image',
				url: request.baseUrl1+'/Resource/Sg/banner2.png',
			}],
			dotStyle: true,
			qrcodeUrl: request.baseUrl1+'/Resource/Sg/GZH_Qrcode.jpg', // 从后端获取的公众号二维码 
			officialAccountUrl: 'weixin://profile/gh_2ffe05116dfe',
			
			ai_png:request.baseUrl1+'/Resource/Sg/ai/ai.png',
			ai_right_png:request.baseUrl1+'/Resource/Sg/ai/ai-right.png',
			showAI: false, // 是否显示 ai.png
			showAIRight: false, // 是否显示 ai-right.png
			timer: null, // 定时器
			showWorkFlow:false,
			userId:'',
			IsWeChatAutoRegister:1,
			treeUserList:[],
			countSetting:{
				jobCount:0,
				qrcodeCount:0,
				SceneCount:0
			},
			userName:'',
			title:'',
			image:{
				mainbg:this.$request22.baseUrl1+'/Resource/Sg/device/main/main-bg.png',
			},
			savingRequestData:{
				qrcodeId:'',
				jobId:'',
				longitude:'',
				latitude:'',
				isCheckDevice:true,
				isNFC:false
			},
			mySortable: null,//拖拉拽
			loadingText: '',
			animation: '',
			animationData: {},
			list:[],
			attendance:[
				// {
				// 	pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/saomaxunjian.png',
				// 	title:'满意度调查',
				// 	id:'addsatisfaction'
				// }
			],
			workflow:[
				
			],
			scene:[
			],
			qrcode:[
				
			],
			qrcodeOld:[
				{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/saomaxunjian.png',
					title:'去巡检',
					id:'xunjian'
				},
				{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/daiweibao.png',
					title:'巡检任务',
					id:'mytask'
				}
			],
			baobiao:[
				
			],
			baobiaoOld:[
				{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/weibaowancheng.png',
					title:'维保完成率',
					id:'rate'
				},{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/lou.png',
					title:'漏检报表',
					id:'lou'
				},
				{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/jihuo.png',
					title:'二维码更新',
					id:'activeqrcode'
				},
				{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/jiagou.png',
					title:'组织架构',
					id:'jiagou'
				},
			],
			manager:[
				{
					pic:this.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/me.png',
					title:'我的',
					id:'me'
				}
			]
			
		}
	},
	mounted(options) {
		console.log("on mounted");
		// 页面ai定时器
		//this.startTimer();
		let that=this
		//that.checkGoWhere(options.pageLabel);
		that.getMainBaseData()
		that.CheckLoginStatus()
		that.getSceneCount();
		that.getUserName();
		
		uni.getStorage({
			key: 'userdata',
			success: function (resuserdata) {
				console.log('userdata')
				let CustomerLogo=resuserdata.data.CustomerLogo
				if(CustomerLogo!=null&&CustomerLogo!=''){
					that.logo=resuserdata.data.CustomerLogo
				}
				that.title=resuserdata.data.CustomerName
				that.IsWeChatAutoRegister=resuserdata.data.IsWeChatAutoRegister
				that.userId = resuserdata.data.UserId
				
				if(resuserdata.data.IsWeChatAutoRegister==1){
					that.updateTabbar();
				}else{
					
				}
			}
		});
		
	},
	onLoad() {
		console.log("on onLoad");
	},
	onShow() {x
		console.log("on show");
	},
	methods: {
		updateTabbar(){
			let that=this
			uni.showLoading({
				title:'加载中...'
			})
			let opts = {
				url: 'api/GetMiniProgramMenu',
				method: 'post'
			};
			request.httpTokenNotCheckRequest(opts).then(res => {
				uni.hideLoading()
				if(res.data.code == 1){
					var MiniProgramMenu=res.data.data.MiniProgramMenu
					var MiniProgramBanner=res.data.data.MiniProgramBanner
					if(MiniProgramBanner){
						that.swiperList=[]
						let swiperItem={id:0,type:'image',url:MiniProgramBanner}
						// id: 0,
						// type: 'image',
						// url: 'https://images.saomaxing.com/website/miniprogram/banner2.png',
						that.swiperList.push(swiperItem)
					}
					
					if(MiniProgramMenu){
						let MiniProgramMenuEntity=JSON.parse(MiniProgramMenu)
						//维修维保
						var weixiuweibao=MiniProgramMenuEntity.buttons.home[0].weixiuweibao
						//定期巡检
						var dingqixunjian=MiniProgramMenuEntity.buttons.home[0].dingqixunjian
						//数据统计
						var shujutongji=MiniProgramMenuEntity.buttons.home[0].shujutongji
						//工作任务
						var gognzuorenwu=MiniProgramMenuEntity.buttons.home[0].gognzuorenwu
						//考勤打开
						var kaoqingdaka=MiniProgramMenuEntity.buttons.home[0].kaoqingdaka
						
						let resuserdata=uni.getStorageSync('userdata');
						
						if(weixiuweibao.add_order){
							let addScene={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/addsceneNew.png',
								title:'添加工单',
								id:'addScene'
							}
							that.scene.push(addScene)
						}
						if(weixiuweibao.device_check){
							let deviceSpotCheck={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/deviceSpotCheck.png',
								title:'设备点检',
								id:'deviceSpotCheck'
							}
							that.scene.push(deviceSpotCheck)
						}
						if(weixiuweibao.point_data){
							let deviceList={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/devicenew.png',
								title:'点位数据',
								id:'deviceList'
							}
							that.scene.push(deviceList)
						}
						if(weixiuweibao.maintain_task){
							let wbTask={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/wb-task.png',
								title:'维保任务',
								id:'wbTask'
							}
							that.scene.push(wbTask)
						}
						if(weixiuweibao.third_maintain){
							let wblist={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/wblist.png',
								title:'第三方维保',
								id:'wblist'
							}
							that.scene.push(wblist)
						}
						if(weixiuweibao.experience){
							let fault={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/fault.png',
								title:'维修经验库',
								id:'fault'
							}
							that.scene.push(fault)
						}
						if(weixiuweibao.spareV1){
							let spareMain={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/spareMain.png',
								title:'备件仓库',
								id:'spareMain'
							}
							that.scene.push(spareMain)
						}
						if(weixiuweibao.spareV2){
							let spareMain_V2={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/spareMain_v2.png',
								title:'备件仓库(新)',
								id:'spareMain_V2'
							}
							that.scene.push(spareMain_V2)
						}
						
						if(dingqixunjian.go_patrol){
							let xunjian={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/saomaxunjian.png',
								title:'去巡检',
								id:'xunjian'
							}
							that.qrcode.push(xunjian)
						}
						if(dingqixunjian.patrol_task){
							let mytask={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/daiweibao.png',
								title:'巡检任务',
								id:'mytask'
							}
							that.qrcode.push(mytask)
						}
						if(dingqixunjian.live_monitor&&resuserdata.IsAdmin==1){
							let location={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/weizhi.png',
								title:'实时位置监控',
								id:'location'
							}
							that.qrcode.push(location)
						}
						if(dingqixunjian.progress&&resuserdata.IsAdmin==1){
							let taskmanage={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/manager.png',
								title:'巡检进度',
								id:'taskmanage'
							}
							that.qrcode.push(taskmanage)
						}
						if(shujutongji.completion_rate&&resuserdata.IsAdmin==1){
							let rate={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/weibaowancheng.png',
								title:'维保完成率',
								id:'rate'
							}
							that.baobiao.push(rate)
						}
						if(shujutongji.missed_report&&resuserdata.IsAdmin==1){
							let lou={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/lou.png',
								title:'漏检报表',
								id:'lou'
							}
							that.baobiao.push(lou)
						}
						if(shujutongji.qrcode_update&&resuserdata.IsAdmin==1){
							let activeqrcode={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/jihuo.png',
								title:'二维码更新',
								id:'activeqrcode'
							}
							that.baobiao.push(activeqrcode)
						}
						if(shujutongji.nfc_bind&&resuserdata.IsAdmin==1){
							let bindNFC={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/jihuo.png',
								title:'NFC绑定',
								id:'bindNFC'
							}
							that.baobiao.push(bindNFC)
						}
						if(shujutongji.organizational&&resuserdata.IsAdmin==1){
							let jiagou={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/jiagou.png',
								title:'组织架构',
								id:'jiagou'
							}
							that.baobiao.push(jiagou)
						}
						if(shujutongji.summary.length>0&&resuserdata.IsAdmin==1){
							let summaryAnalysis={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/summaryAnalysis.png',
								title:'汇总分析',
								id:'summaryAnalysis'
							}
							that.baobiao.push(summaryAnalysis)
						}
						if(gognzuorenwu.task_temp){
							let template={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/workflowTemp.png',
								title:'任务模板',
								id:'template'
							}
							that.workflow.push(template)
						}
						if(gognzuorenwu.task_list){
							let missionList={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/wb-task.png',
								title:'任务列表',
								id:'missionList'
							}
							that.workflow.push(missionList)
						}
						if(gognzuorenwu.task_experience_lib){
							let ExperienceLibrary={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/experienceLibrary.png',
								title:'经验库',
								id:'ExperienceLibrary'
							}
							that.workflow.push(ExperienceLibrary)
						}
						if(kaoqingdaka.go_attendance){
							let goAttendance={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/goAttendance.png',
								title:'去考勤',
								id:'goAttendance'
							}
							that.attendance.push(goAttendance)
						}
						if(kaoqingdaka.attendance_detail){
							let attendanceDetail={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/attendanceDetail.png',
								title:'考勤记录',
								id:'attendanceDetail'
							}
							that.attendance.push(attendanceDetail)
						}
					}else{
						that.getStorageTabbaerConfig()
					}
				}else{
					that.getStorageTabbaerConfig()
				}
			});	
		},
		getStorageTabbaerConfig(){
			let that=this
			uni.getStorage({
				key: 'userdata',
				success: function (resuserdata) {
					that.title=resuserdata.data.CustomerName
					that.IsWeChatAutoRegister=resuserdata.data.IsWeChatAutoRegister
					that.qrcode.push(...that.qrcodeOld)
					that.baobiao.push(...that.baobiaoOld)
					let IsWorkFlow=resuserdata.data.IsWorkFlow
					if(resuserdata.data.IsAdmin==1){
						let taskmanage={
							pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/manager.png',
							title:'巡检进度',
							id:'taskmanage'
						}
						that.qrcode.push(taskmanage)
					}
					//1 维保员   2 业主
					if(resuserdata.data.IsWeChatAutoRegister==2){
						if(resuserdata.data.IsAdmin==1){
							let confirmedWB={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/wb-confirm.png',
								title:'待确认维保',
								id:'confirmedWB'
							}
							that.scene.push(confirmedWB)
						}
					}else{
						let addScene={
							pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/addsceneNew.png',
							title:'添加工单',
							id:'addScene'
						}
						that.scene.push(addScene)
						let deviceList={
							pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/devicenew.png',
							title:'设备档案',
							id:'deviceList'
						}
						that.scene.push(deviceList)
						
						//判断使用什么备件系统
						if(resuserdata.data.IsSpareV2==undefined||resuserdata.data.IsSpareV2==null||resuserdata.data.IsSpareV2==0){
							let spareMain={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/spareMain.png',
								title:'备件仓库',
								id:'spareMain'
							}
							that.scene.push(spareMain)
						}else{
							let spareMain_V2={
								pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/spareMain_v2.png',
								title:'备件仓库(新)',
								id:'spareMain_V2'
							}
							that.scene.push(spareMain_V2)
						}
						
						let fault={
							pic:that.$request22.baseUrl1+'/Resource/Sg/device/main/iconNew/fault.png',
							title:'维修经验库',
							id:'fault'
						}
						that.scene.push(fault)
					}
					
				}
			});
		},
		 // 点击 ai.png
		handleAIClick() {
			// uni.navigateTo({
			//   url: '/pages-ai/test'
			// });
			uni.showToast({
				title: 'AI功能开发中...',
				duration: 3000,
				icon: 'none'
			})
		},
		// 点击 ai-right.png
		handleAIRightClick() {
			this.showAIRight = false;
			setTimeout(() => {
			this.showAI = true;
			}, 0); // 等待动画完成
			this.resetTimer(); // 重置定时器
		},
		// 启动 10 秒定时器
		startTimer() {
			this.timer = setTimeout(() => {
			this.showAI = false;
			setTimeout(() => {
			this.showAIRight = true;
			}, 0); // 等待动画完成
			}, 3000); // 10 秒后显示 ai-right.png
		},
		// 重置定时器
		resetTimer() {
			clearTimeout(this.timer); // 清除之前的定时器
			this.startTimer(); // 重新启动定时器
		},
		//站外进来，看先去哪儿
		checkGoWhere(pageLabel){
			if(pageLabel!=null||pageLabel!=undefined||pageLabel!=''){
				if(pageLabel=='wbindex'){
					uni.navigateTo({
						url: '/pages-weibao/wbIndex'
					})
				}
			}
		},
		goWhere(index){
			if(index===1){
				uni.navigateTo({
					url: '/pages-device/repair/deviceList'
				})
			}
			if(index===2){
				setTimeout(() => {
					 uni.reLaunch({
						url: '/pages/index/tabbar?PageCur=qrcode'
					 });
				}, 0)
			}
			if(index===3){
				setTimeout(() => {
					 uni.reLaunch({
						url: '/pages/index/tabbar?PageCur=index'
					 });
				}, 0)
			}
		},
		getMainBaseData(){
			let opts = {
				url: 'api/getMainBaseData',
				method: 'get'
			};
			request.httpTokenRequest(opts).then(res => {
				if(res.data.code == 1){
					this.countSetting.jobCount=res.data.data.jobCount;
					this.countSetting.qrcodeCount=res.data.data.qrcodeCount;
					this.countSetting.SceneCount=res.data.data.SceneCount;
				}
				else{
					uni.showToast({ title: res.data.msg, icon: 'none' });
				}
			});
		},
		getUserName(){
			let that=this
			uni.getStorage({
				key: 'userdata',
				success: function (res1) {
					if(res1.data.Station!=null&&res1.data.Station!=''){
						that.userName=res1.data.RealName+'('+res1.data.Station+''
					}else{
						that.userName=res1.data.RealName
					}
				}
			});
		},
		CheckLoginStatus(){
			let that=this
			let opts = {
				url: 'api/CheckLoginStatus',
				method: 'get'
			};
			request.httpTokenRequest(opts).then(res => {
				if(res.data.code != 1){
					//提示去登录
					uni.showModal({
						title: '提示',
						content: '账号已过期，请重新登录',
						success: function (res1) {
							if (res1.confirm) {
								setTimeout(() => {
								      uni.reLaunch({
								      	url: '/pages/qrcode/login'
								      });
								}, 0)
								uni.clearStorageSync();
							}
						}
					});
				}
			});
		},
		getSceneCount(){
			let that=this
			let opts = {
				url: 'api/getSceneCounts',
				method: 'get'
			};
			request.httpTokenRequest(opts).then(res => {
				if(res.data.code == 1){
					if(res.data.data.SceneCount>0){
						that.list[0]='您有'+res.data.data.SceneCount+'条维修工单,请及时处理'
					}else{
						that.list=[]
					}
				}else{
					that.list=[]
				}
			});
			console.log(that.list)
		},
		click(id){
			//addsatisfaction
			if(id==='addsatisfaction'){
				uni.navigateTo({
					url: '/pages-others/Satisfaction/addsatisfaction'
				})
			}
			//summaryAnalysis
			if(id==='summaryAnalysis'){
				uni.navigateTo({
					url: '/pages-others/charts/summaryAnalysis'
				})
			}
			//yuyin
			if(id==='yuyin'){
				uni.navigateTo({
					url: '/pages-others/shuiying'
				})
			}
			//shuiying
			if(id==='shuiying'){
				uni.navigateTo({
					url: '/pages-others/shuiying'
				})
			}
			//fault
			if(id==='fault'){
				uni.navigateTo({
					url: '/pages-others/fault/fault'
				})
			}
			//第三方维保
			if(id==='wblist'){
				uni.navigateTo({
					url: '/pages-others/ThirdPartyMaintenance/list'
				})
			}
			//待确认维保
			if(id==='confirmedWB'){
				uni.navigateTo({
					url: '/pages-weibao/confirmedWB'
				})
			}
			//维保列表
			if(id==='wbTask'){
				uni.navigateTo({
					url: '/pages-weibao/wbIndex'
				})
			}

			// 任务列表
			// if(id==='missionList'){
			// 	uni.navigateTo({
			// 		url: '/pages-weibao/missionIndex'
			// 	})
			// }
			// 任务列表
			if(id==='missionList'){
				uni.navigateTo({
					url: '/pages-workflow/WorkTasks/goAttendance'
				})
			}
			
			// 经验库
			if(id==='ExperienceLibrary'){
				uni.navigateTo({
					url: '/pages-weibao/experienceIndex'
				})
			}
			
			//备件仓库spareMain
			
			if(id==='spareMain_V2'){
				uni.navigateTo({
					url: '/pages/spare/main_v2'
				})
			}
			if(id==='spareMain'){
				uni.navigateTo({
					url: '/pages/spare/main'
				})
			}
			//设备点检
			if(id==='deviceSpotCheck'){
				uni.navigateTo({
					url: '/pages/mytask/SpotChcekList'
				})
			}
			if(id==='test'){
				uni.navigateTo({
					url: '/pages-others/userdepart'
				})
			}
			if(id==='mytask'){
				uni.navigateTo({
					url: '/pages-others/mytask'
				})
			}
			if(id==='taskmanage'){
				uni.navigateTo({
					url: '/pages-others/taskmanage'
				})
			}
			if(id==='addScene'){
				uni.navigateTo({
					url: '/pages/qrcode/scene/add/add'
				})
			}
			if(id==='handleScene'){
				
				setTimeout(() => {
					 uni.reLaunch({
						url: '/pages/index/tabbar?PageCur=index'
					 });
				}, 0)
			}
			if(id==='xunjian'){
				setTimeout(() => {
					 uni.reLaunch({
						url: '/pages/index/tabbar?PageCur=qrcode'
					 });
				}, 0)
			}
			if(id==='scanScene'){
				let that = this;
				uni.scanCode({
					onlyFromCamera: false,
					success: function(res) {
						let qrcodeId=request1.getRequest(res.result,'id')
						//跳转添加页面
						uni.navigateTo({
							url: '/pages/qrcode/scene/add/add?qrcodeid='+qrcodeId
						})
					},fail() {
						uni.hideLoading();
					}
				});
			}
			if(id==='deviceList'){
				uni.navigateTo({
					url: '/pages-device/repair/deviceList'
				})
			}
			
			
			
			if(id==='workflow'){
				uni.navigateTo({
					url: '/pages-device/workflow/maintenanceList'
				})
			}
			if(id==='location'){
				uni.navigateTo({
					url: '/pages-others/track'
				})
			}
			if(id==='lou'){
				uni.navigateTo({
					url: '/pages-others/charts/lou'
				})
			}
			if(id==='me'){
				uni.navigateTo({
					url: '/pages-others/me'
				})
			}
			if(id==='rate'){
				uni.navigateTo({
					url: '/pages-others/charts/echarts'
				})
			}
			if(id==='activeqrcode'){
				uni.navigateTo({
					url: '/pages-others/activeqrcode'
				})
			}
			if(id==='scan'){
				this.qrcodeClick();
			}
			if(id==='device'){
				uni.navigateTo({
					url: '/pages-device/repair/deviceList'
				})
			}
			if(id==='scandata'){
				uni.navigateTo({
					url: '/pages-device/repair/scandata'
				})
			}
			if(id==='sceneEcharts'){
				uni.navigateTo({
					url: '/pages-others/sceneEcharts'
				})
			}
			
			
			if(id==='newSceneDetail'){
				uni.navigateTo({
					url: '/pages-scene/detail'
				})
			}
			
			if(id==='todaytask'){
				uni.navigateTo({
					url: '/pages-others/todaytask'
				})
			}
			
			//template
			if(id==='template'){
				uni.navigateTo({
					url: '/pages-workflow/flowDemo'
				})
			}
			//bindNFC
			if(id==='bindNFC'){
				uni.navigateTo({
					url: '/pages-others/bindNFC'
				})
			}
			if(id==='goAttendance'){
				uni.navigateTo({
					url: '/pages-others/attendance/goAttendance'
				})
			}
			if(id==='attendanceDetail'){
				uni.navigateTo({
					url: '/pages-others/attendance/attendanceDetail'
				})
			}
			if(id==='jiagou'){
				let that=this
				//指派
				//打开弹窗
				let opts = {
					url: 'api/GetDepartmentTreeList',
					method: 'get'
				};
				uni.showLoading({
					title: '加载中'
				})
				let GetDepartmentTreeListPara={
					type:'all'
				}
				request1.httpTokenRequest(opts,GetDepartmentTreeListPara).then(res => {
					uni.hideLoading();
					if(res.data.code == 1){
						that.treeUserList=res.data.data
						that.sceneAssignId=id
						this.$refs.treePicker._show();
					}else{
						uni.showToast({ title: '人员架构获取失败', icon: '/static/cha.png' });
					}
				})
			}
		},
		//不需要计划，时间等，直接巡检
		qrcodeClick() {
			uni.showLoading({
				title: '提交中'
			})
			let that = this;
			 // 只允许通过相机扫码
			 uni.scanCode({
				 onlyFromCamera: true,
				 success: function(res) {
					 console.log(res)
					 that.result2 = res.result;
					 
					 let qrcodeId=request.getRequest(res.result,'id')
					 that.savingRequestData.qrcodeId=qrcodeId
					 
					//获取点位详情
					let opts111 = {
					 	url: 'api/GetQrcodeById',
					 	method: 'get'
					};
					let getQrcode={id:qrcodeId}
					 
					let newType=0;
					request.httpTokenRequest(opts111,getQrcode).then(qrcodeRes => {
						if(qrcodeRes.data.code == 1){
							newType=qrcodeRes.data.data
							if(newType==2){
								// 跳转，传参
								uni.navigateTo({
									url:`/pages-device/repair/record?id=${qrcodeId}&type=${newType}&noJob=1`
								})
								return
							}
							that.savingRequestData.jobId=0;
							let opts = {
								url: 'api/SavingQrcodeDirectForMain',
								method: 'get'
							};
							uni.getLocation({
								type: 'gcj02',
								isHighAccuracy:true,
								success(res3) {
									that.savingRequestData.latitude = res3.latitude;
									that.savingRequestData.longitude = res3.longitude;
									request.httpTokenRequest(opts,that.savingRequestData).then(res => {
										console.log(res)
										if(res.data.code == 1){
											uni.hideLoading();
											console.log(res.data.data)
											if(res.data.data.firstGo=='goDeviceDeatil'){
												//去设备详情页
												uni.navigateTo({
													url: '/pages/qrcode/qrcodejob/device?qrcodeid='+qrcodeId+'&secondGo='+res.data.data.secondGo+'&noJob=1'
												})
											}else if(res.data.data.firstGo=='goPhone'){
												//去拍照1
												uni.navigateTo({
													url: '/pages/qrcode/qrcodejob/photo?qrcodeid='+qrcodeId+'&signid='+res.data.msg+'&noJob=1'
												})
											}else if(res.data.data.firstGo=='goTopic'){
												//去答题
												uni.navigateTo({
													url: '/pages/qrcode/qrcodejob/topic?qrcodeid='+qrcodeId+'&signid='+res.data.msg+'&noJob=1'
												})
											}else{
												//直接结束
												uni.showToast({ title: '签到成功', icon: '/static/success.png' });
											}
										}
										else{
											uni.hideLoading();
											uni.showToast({ title: res.data.msg, icon: 'none' });
										}
									});
								},
								fail: function () {
									uni.hideLoading();
									uni.showToast({
										title: '定位失败，请退出登陆重新开启定位',
										icon:'none',
										duration: 4000
									});
								}
							});
						}else
						{
							uni.showToast({ title: res.data.msg, icon: 'none' });
						}
					});
					 
					 
					 
					 
				 },fail() {
					uni.hideLoading();
				 }
			 });
		},
	}
}
</script>
<style lang="scss" scoped>
	.text-xxl{
		font-size: 60rpx;
	}
	.container {
		width: 750rpx;
		color: #333333;
		.bg-top {
			margin-top: -1rpx;
			width: 750rpx;
			height: 220rpx;
			padding-top: 50rpx;
			border-radius: 0 0 20% 20%;
	
			.top-box {
				width: 95%;
				background-color: #FFFFFF;
				margin: 0 auto;
				border-radius: 20rpx;
				padding: 10rpx 15rpx 0rpx;
				position: relative;
				margin-bottom: 20rpx;
				.main-bg{
					width: 100%;
					height: 300rpx;
					border-radius: 30upx;
				}
			}
		}
	
		.center-box {
			color: #333333;
			width: 700rpx;
			background-color: #FFFFFF;
			margin: 0 auto;
			border-radius: 20rpx;
			padding: 0rpx 30rpx 0rpx;
			position: relative;
			margin-top: 20rpx;
		}
	}
	.index_sort_6 {white-space:normal;
			width:100%;
			height:100%;
			padding:0upx;
			clear:both;
			float:left; 
			border-radius:0upx;
			font-size:0upx; 
			line-height:1upx
		}
	.index_sort_6 .long_press_and_drag_to_adjust_sorting{white-space:normal;width:264upx;height:28upx;padding:0upx;clear:both;margin-top:51upx;margin-left:76upx;float:left; border-radius:0upx; color:#646464;font-size:22upx; line-height:28upx;}
	.index_sort_6 .sort{
		white-space:normal;
		width:100%;
		height:auto;
		padding-left:0upx;
		padding-right:0upx;
		padding-top:30upx;
		padding-bottom:0upx;
		clear:both;
		margin-top:0upx;
		margin-left:0upx;
		float:left;
		border-radius:0upx;
		font-size:8upx
		}
	.index_sort_6 .sort .item{
		white-space:normal;
		width:25%;
		height:170upx;
		margin-bottom:20upx;
		margin-left:0upx;
		float:left;
		border-radius:0upx;
		font-size:8upx;
		}
	.index_sort_6 .sort .item .pic{
		white-space:normal;
		width:86upx;
		height:86upx;
		overflow:hidden;
		margin:auto;
		clear:both;
		left:50%;
		margin-left:-43upx;
		justify-content:center;
		font-size:8upx; 
		line-height:86upx;
		}
	.index_sort_6 .sort .item .title{
		white-space:normal;
		width:100%;
		height:25upx;
		margin-top:20upx;
		clear:both;
		float:left;
		text-align:center;
		justify-content:center;
		border-radius:0upx;
		color:#121111;
		font-size:26upx; 
		line-height:25upx;
		font-weight:600;
		}
		.itemBox{
			position: relative;
		}
	.reddot{
		color: #fff;
		background-color: #dd514c;
		border-radius: 50%;
		width: 32rpx;
		height: 32rpx;
		line-height: 32rpx;
		text-align: center;
		font-size: 20rpx;
		position: absolute;
		right: 15px;
		top: -10px;
		z-index: 99;
	}
	.index_sort_6 .index_sort_42{white-space:normal;width:auto;height:183upx;padding:0upx;clear:both;float:left;position: fixed;z-Index: 100000;left:0upx;bottom:0upx; border-radius:0upx;font-size:8upx;}
	.index_sort_6 .index_sort_42 .determine{white-space:normal;width:679upx;height:83upx;overflow:hidden;padding:0upx;margin-top:43upx;margin-left:35upx;float:left;background-color:#009eff;text-align:center;justify-content:center; border-radius:10upx; cursor:pointer; color:#ffffff;font-size:26upx; line-height:83upx;}
	
	
	.cu-item-title-text{
		color: #333;font-weight: 700;font-size: 32rpx;border-left: 4px solid #0081ff;padding-left: 20rpx;
	}
	.cu-item-title-right{
		color: #666;font-weight: 400;font-size: 26rpx;padding-left: 20rpx;padding-right: 20rpx;
	}
	.cu-list-next{
		min-height: 60rpx;
	}
	.cu-item-title-next{
		min-height: 60rpx;
	}
	.cu-item-title-text-next{
		color: #55aaff;font-weight: 600;font-size: 28rpx;padding-left: 0rpx;line-height: 60rpx;
	}
	
    /* 悬浮图标容器 */
    .floating-icon {
       position: fixed;
       right: 20rpx;
       bottom: 150rpx;
       z-index: 9999;
       display: flex;
       align-items: center;
       justify-content: center;
       //cursor: pointer;
   
       .ai-icon {
         width: 60px;
         height: 69.4px;
       }
   
       .ai-right-icon {
         width: 22.74px;
         height: 100px;
		 right:-20rpx;
       }
    }
   
     /* ai.png 的容器 */
    .ai-container {
       position: absolute;
       right: 0;
       transition: transform 0.5s ease, opacity 0.5s ease;
    }
   
     /* ai.png 滑入动画 */
    .slide-in {
       transform: translateX(0);
       opacity: 1;
    }
   
     /* ai.png 滑出动画 */
    .slide-out {
       transform: translateX(100%);
       opacity: 0;
    }
	
</style>